package org.cars.designPatterns.patterns.AbstractFactory.factory.impl;

import org.cars.designPatterns.patterns.AbstractFactory.factory.AbstractFactory;
import org.cars.designPatterns.patterns.AbstractFactory.service.Color;
import org.cars.designPatterns.patterns.AbstractFactory.service.Shape;
import org.cars.designPatterns.patterns.AbstractFactory.service.impl.Blue;
import org.cars.designPatterns.patterns.AbstractFactory.service.impl.Green;
import org.cars.designPatterns.patterns.AbstractFactory.service.impl.Red;

/**
 * @author caoqianfan
 * @date 2024/5/20 下午5:30
 */
public class ColorFactory extends AbstractFactory {

    @Override
    public Shape getShape(String shapeType){
        return null;
    }

    @Override
    public Color getColor(String color) {
        if(color == null){
            return null;
        }
        if(color.equalsIgnoreCase("RED")){
            return new Red();
        } else if(color.equalsIgnoreCase("GREEN")){
            return new Green();
        } else if(color.equalsIgnoreCase("BLUE")){
            return new Blue();
        }
        return null;
    }
}